package com.pkx.guide.record.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.guide.common.annotation.ORpose;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pkx.guide.record.entity.TRecordGuidePublishTask;
import com.pkx.guide.record.service.TRecordGuidePublishTaskService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import com.pkx.guide.common.annotation.Log;
import com.pkx.guide.common.enums.BusinessType;
import lombok.extern.slf4j.Slf4j;

/**
 * 诱导屏发布任务记录表 控制器
 *
 * @author sunsy
 * @since 2023-11-16
 */
@RestController
@RequestMapping("/record/publishTask")
@Tag(name = "诱导屏发布任务记录表")
@Slf4j
@ORpose
public class TRecordGuidePublishTaskController {

    @Autowired
    private TRecordGuidePublishTaskService tRecordGuidePublishTaskService;

    @Operation(summary = "诱导屏发布任务记录表分页列表")
    @GetMapping("/page")
    public IPage<TRecordGuidePublishTask> page(Page page, TRecordGuidePublishTask tRecordGuidePublishTask) {
        return tRecordGuidePublishTaskService.pageList(page,tRecordGuidePublishTask);
    }

    @Operation(summary = "诱导屏发布任务记录表列表")
    @GetMapping("/list")
    public List<TRecordGuidePublishTask> list(TRecordGuidePublishTask tRecordGuidePublishTask) {
        return tRecordGuidePublishTaskService.listByEntity(tRecordGuidePublishTask);
    }

    @Operation(summary = "诱导屏发布任务记录表详情")
    @GetMapping(value = "/{id}")
    public TRecordGuidePublishTask selectById(@PathVariable("id") Integer id) {
        return tRecordGuidePublishTaskService.selectById(id);
    }

    @Operation(summary = "诱导屏发布任务记录表新增")
    @PostMapping("/")
    @Log(title = "诱导屏发布任务记录表", businessType = BusinessType.INSERT)
    public Boolean add(@RequestBody TRecordGuidePublishTask tRecordGuidePublishTask) {
        return tRecordGuidePublishTaskService.saveTRecordGuidePublishTask(tRecordGuidePublishTask);
    }

    @Operation(summary = "诱导屏发布任务记录表修改")
    @PutMapping("/")
    @Log(title = "诱导屏发布任务记录表", businessType = BusinessType.UPDATE)
    public Boolean modify(@RequestBody TRecordGuidePublishTask tRecordGuidePublishTask) {
        return tRecordGuidePublishTaskService.modify(tRecordGuidePublishTask);
    }

    @Operation(summary = "诱导屏发布任务记录表删除(单个条目)")
    @DeleteMapping(value = "/{id}")
    @Log(title = "诱导屏发布任务记录表", businessType = BusinessType.DELETE)
    public Boolean deleteById(@PathVariable("id") Integer id) {
        return tRecordGuidePublishTaskService.deleteById(id);
    }
}
